package com.baijiaoxi.common.model.query;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.List;

@ApiModel("分页对象")
public class Page<T> extends com.baomidou.mybatisplus.extension.plugins.pagination.Page<T> {
    @ApiModelProperty(value = "总条数")
    protected long total;

    @JsonIgnore
    protected long size;
    @JsonIgnore
    @ApiModelProperty(hidden = true)
    protected List<T> records;
    @JsonIgnore
    protected long current;
    @JsonIgnore
    protected List<OrderItem> orders;
    @JsonIgnore
    protected boolean optimizeCountSql;
    @JsonIgnore
    protected boolean isSearchCount;
    @JsonIgnore
    protected boolean hitCount;


    public Page() {
        super();
    }

    public Page(long current, long size) {
        this(current, size, 0L);
    }

    public Page(long current, long size, long total) {
        this(current, size, total, true);
    }

    public Page(long current, long size, boolean isSearchCount) {
        this(current, size, 0L, isSearchCount);
    }

    public Page(long current, long size, long total, boolean isSearchCount) {
        super(current, size, total, isSearchCount);
    }

    @Override
    @JsonIgnore
    public boolean isSearchCount() {
        return super.isSearchCount();
    }

    @ApiModelProperty(value = "数据列表")
    public List<T> getRows() {
        return super.records;
    }

    public com.baomidou.mybatisplus.extension.plugins.pagination.Page<T> setRows(List<T> list) {
        return super.setRecords(list);
    }

    @Override
    @ApiModelProperty(value = "总页数")
    public long getPages() {
        return super.getPages();
    }


}
